#ifndef __VLOG_LOGAPPENDER_H__
#define __VLOG_LOGAPPENDER_H__
#include <chrono>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <mutex>
#include <pthread.h>
#include <sys/mman.h>
#include <thread>

#include "../logformatter.h"

namespace vlog
{

// 日志输出基类
class LogAppender
{
    public:
    using ptr = std::shared_ptr<LogAppender>;

    LogAppender() = delete;
    LogAppender(LogFormatter::ptr pLogformater);

    virtual ~LogAppender() = default;

    void SetLogFormater(LogFormatter::ptr plogFormat) noexcept;

    LogFormatter::ptr GetLogFormater() const noexcept;

    virtual void WriteLog(event::LogEvent::ptr pEvent) = 0;

    protected:
    // 每个日志输出器有一个默认的format,当logevent没有设置format是使用这个format
    LogFormatter::ptr m_pLogFormater; // 默认的formatter
};

} // namespace vlog

#endif